﻿
Partial Class Paginas_InscribirEvento
    Inherits System.Web.UI.Page

#Region "Funciones de la Página"
    Public Function OpcionesEventos(ByVal Activo As String, ByVal Codigo As String) As String
        Dim strHTML As String = ""
        strHTML = "<img src='img/publicar.gif' style='cursor:pointer;' alt='Inscribir Evento' onClick='ReenviarPag(1," & Codigo.Trim & ");'/>&nbsp;&nbsp;"
        Return strHTML
    End Function

    Private Sub CargarEventos()
        Dim miCollect As New Collection
        Dim minegEven As New dllNegocio.NegEventos(System.Configuration.ConfigurationManager.AppSettings.Get("SPECBDD"))
        Dim objEven As New dllEntidades.clsEventos
        Dim objFuncionario As New dllEntidades.clsFuncionario
        Try
            Session("SeekEvento") = Me.txtNombreEvento.Text.Trim

            objEven.Codigo = 0
            objEven.Nombre = Me.txtNombreEvento.Text.Trim
            objEven.CodigoTipoAsistente = Me.ddlTipoAsistencia.SelectedItem.Value.Trim
            objFuncionario.Rut = Session("RutUsuario")
            miCollect = minegEven.ListarEventosPublicados(objEven, objFuncionario)
            Me.GrillaResultados.DataSource = miCollect
            Me.GrillaResultados.DataBind()
        Catch ex As Exception
        Finally
            miCollect = Nothing
            minegEven.dispose()
            minegEven = Nothing
            objEven.Dispose()
            objEven = Nothing
            objFuncionario.Dispose()
            objFuncionario = Nothing
        End Try
    End Sub

    Private Sub CargarCombos()
        Dim miCollect As New Collection
        Dim miNegTAdm As New dllNegocio.NegTiposAsistente(System.Configuration.ConfigurationManager.AppSettings.Get("SPECBDD"))
        Try
            miCollect = miNegTAdm.ListaTipoAsistenteVigente()
            Me.ddlTipoAsistencia.DataSource = miCollect
            Me.ddlTipoAsistencia.DataTextField = "Descripcion"
            Me.ddlTipoAsistencia.DataValueField = "Codigo"
            Me.ddlTipoAsistencia.DataBind()
            Me.ddlTipoAsistencia.Items.Insert(0, New ListItem("--Selecione Tipo de Asistente--", "0"))
        Catch ex As Exception
        Finally
            miCollect = Nothing
            miNegTAdm.Dispose()
            miNegTAdm = Nothing
        End Try
    End Sub
#End Region

    Protected Sub btnBuscar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnBuscar.Click
        Call CargarEventos()
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Call CargarCombos()
            If Request.QueryString("PostBack") = "SI" Then
                Me.txtNombreEvento.Text = Session("SeekEvento")
                Call CargarEventos()
            End If
        End If
    End Sub
End Class

